package school.valon.persistence.pojo;

import java.io.Serializable;

import javax.persistence.*;

import java.util.List;


/**
 * The persistent class for the parent database table.
 * 
 */
@Entity
@Table(name="parent")
@PrimaryKeyJoinColumn(name="parent_id", referencedColumnName="user_id")
@DiscriminatorValue("4")
@NamedQueries({
@NamedQuery(name="Parent.findAll", query="SELECT p FROM Parent p"),
@NamedQuery(name="Parent.deleteById", query="DELETE FROM Parent WHERE parentId = :P1")
})
public class Parent extends User implements Serializable {

	private static final long serialVersionUID = 1845421905941640122L;

	@Column(name="parent_id", insertable=false, updatable=false)
	private Integer parentId;

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="address_id", referencedColumnName="address_id")
	private Address address;

	@Column(name="emergency_contact")
	private String emergencyContact;

	//bi-directional many-to-many association to Student
	@OneToMany(mappedBy="father", fetch=FetchType.LAZY)
	private List<Student> fatherStudents;

	@OneToMany(mappedBy="mother", fetch=FetchType.LAZY)
	private List<Student> motherStudents;

	//bi-directional many-to-one association to StudentClassRecordingComment
	@OneToMany(mappedBy="parent", fetch=FetchType.LAZY)
	private List<StudentClassRecordingComment> studentClassRecordingComments;

	public Integer getParentId() {
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	public Address getAddress() {
		return this.address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public String getEmergencyContact() {
		return this.emergencyContact;
	}

	public void setEmergencyContact(String emergencyContact) {
		this.emergencyContact = emergencyContact;
	}

	public List<Student> getFatherStudents() {
		return fatherStudents;
	}

	public void setFatherStudents(List<Student> fatherStudents) {
		this.fatherStudents = fatherStudents;
	}

	public List<Student> getMotherStudents() {
		return motherStudents;
	}

	public void setMotherStudents(List<Student> motherStudents) {
		this.motherStudents = motherStudents;
	}

	public List<StudentClassRecordingComment> getStudentClassRecordingComments() {
		return studentClassRecordingComments;
	}

	public void setStudentClassRecordingComments(
			List<StudentClassRecordingComment> studentClassRecordingComments) {
		this.studentClassRecordingComments = studentClassRecordingComments;
	}
}